<?php if ( ! defined('WDK_PATH')) exit('No direct script access allowed');?>
<table id="listTable" class="list">
	<caption>
		<div class="fl">
			총 <span id="total">0</span>개의 게시물이 등록되어있습니다.
		</div>
		<div class="fr">
			<form id="searchForm" onsubmit="return false;">
				<select name="sf">
					<option value="bbs_user_title">제목</option>
					<option value="post_user_name">작성자</option>
					<option value="post_content">내용</option>
				</select>
				<input type="text" name="sk" class="input"/>
				<a href="javascript:;" class="btn">검색</a>
			</form>
		</div>
		<div class="fr">
			<select id="bbs_seq">
				<option value="">게시판선택</option>
				<!--{@ bbs_list }-->
				<option value="{.bbs_seq}"<!--{? .bbs_seq == bbs_seq }--> selected="selected"<!--{/}-->>{.bbs_name}</option>
				<!--{/}-->
			</select>
		</div>
	</caption>
	<colgroup>
		<col style="width:20px;"/>
		<col style="width:60px;"/>
		<col style="width:100px;"/>
		<col style="width:*;"/>
		<col style="width:80px;"/>
		<col style="width:120px;"/>
		<col style="width:140px;"/>
		<col style="width:80px;"/>
	</colgroup>
	<thead>
		<tr>
			<th><input type="checkbox" class="checkAll"/></th>
			<th>No</th>
			<th>카테고리</th>
			<th>제목</th>
			<th>조회수</th>
			<th>작성자</th>
			<th>등록일</th>
			<th>편집</th>
		</tr>
	</thead>
	<tbody data='{json}'></tbody>
	<tfoot>
		<tr>
			<td colspan="8">
				<div class="fl">
					<a id="btn_list" class="btn" href="javascript:;">목록</a>
					<!--{? bbs_seq}-->
					<a id="btn_new" class="btn" href="javascript:;">등록</a>
					<!--{/}-->
					<a id="btn_del" class="btn" href="javascript:;">선택삭제</a>
				</div>
				<div id="pagebar" class="fr"></div>
			</td>
		</tr>
	</tfoot>
</table>
{# plugin listmanager #}
<!--{**************************************************************************}-->
<script>
(function($){
	$('#btn_list').click(function(){
		location.href = $PATH;
	});
	$('#btn_new').click(function(){
		popup($PATH+'edit/0/'+$('#bbs_seq').val(), 950, 660, 'be');
	});
	$('#btn_del').click(function(){
		wlm.del();
	});
	$('#bbs_seq').change(function(){
		location.href = $PATH+$(this).val();
	});
	WdListManager.prototype.draw = function(json)
	{
		var tag = [];
		tag.push('<td class="tc"><input type="checkbox" value="'+json.seq+'" bbs_seq="'+json.bbs_seq+'"/></td>');
		tag.push('<td class="tc to">'+json.no+'</td>');
		tag.push('<td class="tc ">'+json.category_name+'</td>');
		tag.push('<td class="to">&nbsp;&nbsp;'+json.title+'</td>');
		tag.push('<td class="tc">'+json.hits+'</td>');
		tag.push('<td class="tc to">'+json.user_nick+'</td>');
		tag.push('<td class="tc">'+json.insert_time+'</td>');
		tag.push('<td class="tc to"><a href="javascript:;" class="btn edit">편집</a></td>');
		return tag.join("");
	};
	WdListManager.prototype.draw_event = function()
	{
		$(this.root+'>tbody>tr').map(function(){
			var self = $(this);
			self.find('.edit').click(function(){
				popup($PATH+'edit/'+self.find(':checkbox').val()+'/'+self.find(':checkbox').attr('bbs_seq'), 950, 660, 'be');
			});
		});
	};
	$(document).ready(function(){
		wlm = new WdListManager($PATH);
		wlm.set_root('#listTable');
		wlm.set_totalbox('#listTable #total');
		wlm.set_pagebar('#listTable #pagebar');
		wlm.set_param('fk_bbs_seq', $('#bbs_seq').val());
		wlm.preload();
	});
})(jQuery);
</script>
<!--{**************************************************************************}-->